<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" href="bootstrap-3.3.7-dist/css/bootstrap.min.css">

<script src="bootstrap-3.3.7-dist/js/jquery.min.js"></script>
<script src="bootstrap-3.3.7-dist/js/bootstrap.min.js"></script>


<script>
	/* $(function() {
	    $('#scoreProMemberML').modal('hide');
	}); */
</script>

<script>
	/* $(function(){
		debugger;
	    $('#scoreProMemberML').on('#submit',
	    		function(){
	    	    debugger;
	    			var urpid = document
						.getElementById("scoreurpid").value;
					var subjectivescore = document
						.getElementById("jingliscore").value;
					var projectid=document
						.getElementById("scoreprojectid").value;
					var projectusernow = document
						.getElementById("scorePurNowNo").value;
					var oldscore = document
					.getElementById("oldscore").value;
					var objectivescore = document
					.getElementById("objectivescore").value;
					alert(subjectivescore+"   "+oldscore)
					if(subjectivescore==""||(subjectivescore==oldscore)){
						alert("请重新评分");
							$("#jingliscore").val("+jingliscore");
							
					}else{
						 var param = "urpid=" + urpid
							+ "&subjectivescore=" + subjectivescore+"&objectivescore=" + objectivescore;
						alert(param);
						
						//取到插入mission表的参数，申请后台插入，刷新列表
						
						$.ajax({
								type : 'post',
								url : 'scoreProMember.do',
								data : param,
								success : function(data) {
									alert("成功创建阶段任务");
									projectUserFenYe(projectid,projectusernow);
						       
								},
								error : function() {
									alert("出错了！");
									 
								}
							}); 
					}
	    	
	    		}
	    
	    
	    
	    
	    
	    
	    
	    
	    )
	}); */
	function test(){
		var urpid = document
		.getElementById("scoreurpid").value;
	var subjectivescore = document
		.getElementById("jingliscore").value;
	var projectid=document
		.getElementById("scoreprojectid").value;
	var projectusernow = document
		.getElementById("scorePurNowNo").value;
	var oldscore = document
	.getElementById("oldscore").value;
	var objectivescore = document
	.getElementById("objectivescore").value;
	alert(subjectivescore+"   "+oldscore)
	if(subjectivescore==""||(subjectivescore==oldscore)){
		alert("请重新评分");
			$("#jingliscore").val("+jingliscore");
			
	}else{
		 var param = "urpid=" + urpid
			+ "&subjectivescore=" + subjectivescore+"&objectivescore=" + objectivescore;
		alert(param);
		
		//取到插入mission表的参数，申请后台插入，刷新列表
		
		$.ajax({
				type : 'post',
				url : 'scoreProMember.do',
				data : param,
				success : function(data) {
					alert("成功修改评分");
					projectUserFenYe(projectid,projectusernow);
		       
				},
				error : function() {
					alert("出错了！");
					 
				}
			});
	}

	$('#scoreProMemberML').hide();
	}
</script>
<script>

function projectUserFenYe(projectid1,projectUserNowNo1){
	
     var total="${projectUserTotalNo}";
     
     if(parseInt(projectUserNowNo1)<=parseInt(total)&parseInt(projectUserNowNo1)>=1){
	var teamMember=document.getElementById("panel-808913");
	var type1=document.getElementById("type1");
	var type2=document.getElementById("type2");
	var projectUserFenYe=document.getElementById("projectUserFenYe");
	
	var param="projectid="+projectid1+"&projectUserNowNo="+projectUserNowNo1;
	
	 
	// location.href="projectUserFenYe.do?"+param;
	 $.post("projectUserFenYe.do",
			{
				projectid:projectid1,
				projectUserNowNo:projectUserNowNo1
			},
			function(data){
				/* alert(data); */
			if(data!=null&&data.length!=0){
				$("#type1 .group").html("");
                var d=data.list;
               for(var i=0;i<d.length;i++){
            	   $("#type1 .group").append('<div class="grouplist"><div class="im"><img src="'+d[i].headimage+'" height="100" width="100" style="margin-left:25px;"/></div>'+
						'<div class="imright">姓名：'+d[i].userName+'</br> 邮箱：${teamuser.email}</br> 电话:'+d[i].tel+'</br> 项目评分：'+d[i].projectScore+'</br>'+
							'<button type="button" class="btn btn-default btn-sm" onclick="scoreProjectMember('+d[i].userId+','+projectid1+','+data.at+')">'+
								'<span ></span> 成员评价</button></div></div>')
               }
               
				$("#projectUserFenYe center").html('<ul class="pagination"><li><a>共'+data.pages+'页</a></li>'+
						'<li><a href="javascript:projectUserFenYe('+projectid1+','+(data.at-1)+')">Prev</a></li>'+
						'<li><a>'+data.at+'</a></li><li><a href="javascript:projectUserFenYe('+projectid1+','+(data.at+1)+')">Next</a></li></ul>')
               
               
			}else{
					 $("#type1 .group").html("");
				}
			},"json"
	);  
     }
	
}

function scoreProjectMember(userid,projectid1,projectUserNowNo1){
	var param="userid="+userid+"&projectid="+projectid1;
	alert(param);
	
	$.ajax({
		type : 'post',
		url : 'scoreProjectMember.do',
		data : param,
		dataType:"json",
		success : function(data) {
			var html='<tr><th>成员名</th><td>'+data.userName+'</td></tr>'+
						'<tr><th>成员分配任务数</th><td>'+data.allocateMissionNB+'</td></tr>'+
						'<tr><th>成员完成任务数</th><td>'+data.completedMissionNB+'</td></tr>'+
						'<tr><th>系统评分</th><td>'+data.objectivescore+'</td></tr>'+
						'<tr><th>经理评分</th><td><input type="text" id="jingliscore" value="'+data.subjectivescore+'"></td></tr>'+
						'<input type="hidden" id="scoreurpid" value="'+data.urpid+'">'+
						'<input type="hidden" id="scoreprojectid" value="'+projectid1+'">'+
						'<input type="hidden" id="scorePurNowNo" value="'+projectUserNowNo1+'">'+
						'<input type="hidden" id="oldscore" value="'+data.subjectivescore+'">'+
						'<input type="hidden" id="objectivescore" value="'+data.objectivescore+'">';
						$("#proUserDetail").empty();
			
						$("#proUserDetail").append(html);

		},
		error : function() {
			alert("出错了！");
		}
	});
}

</script>
<style type="text/css">
    .group
    {	
   		height: 400px;
    	width:800px;
    	
       
    }
    .grouplist
    {	
    	float:left;
    	background: url(style/image/background/card1.png) no-repeat;
    	background-size: 100% 100%;
    	height: 200px;
    	width:400px;
        font-size: 15px;
    }
    .grouplist:hover{
    background: url(style/image/background/card2.png) no-repeat;
    background-size: 100% 100%;
    }
    .im{
    	padding-top:25px;
        float:left;
    	height: 150px;
    	width: 100px;
    }
    .imright{
  		
  		float:left;
  		padding-top:25px;
  		padding-left:20px;
    	height: 200px;
    	width: 300px;
    	line-height: 2.0;
    }
	.pj {
	
}

.projectlist {
	padding-top: 10px;
	margin: 5px;
	float: left;
	text-align: center;
	height: 200px;
	width: 200px;
	font-size: 20px;
}

.projectlist:hover {
	background-color: #EEEED1;
}

</style>

<title>Insert title here</title>
</head>
<body>
	<div>
	<!-- type1 start -->
							<div id="type1">
							<center>
								<div class="group">



									<c:if test="${empty projectUserList}">

									</c:if>
									<c:if test="${not empty projectUserList}">
										<c:forEach var="teamuser" items="${projectUserList}">
											<div class="grouplist">
												<div class="im">
													<img src="${teamuser.headimage}" height="100" width="100" Style="margin-left:25px;"/>
												</div>
												<div class="imright">
													姓名：${teamuser.userName}
													</br> 邮箱：${teamuser.email}</br> 电话:${teamuser.tel}</br> 团队评分：${teamuser.projectScore}</br>
													<button type="button" class="btn btn-default btn-sm" onclick="scoreProjectMember(${teamuser.userId},${nowprojectid},${projectUserNowNo})"
													data-toggle="modal" data-target="#scoreProMemberMl">
														<span ></span> 成员评价
														
													</button>
													
												</div>
											</div>
										</c:forEach>
									</c:if>


								
								</div>
								</center>
							</div>
							<!-- type1 end -->
							<div id="projectUserFenYe">
							<center>
																		
										<ul class="pagination">
											<li><a>共${projectUserTotalNo}页</a></li>
											<li><a href="javascript:projectUserFenYe(${nowprojectid},${projectUserNowNo-1})">Prev</a></li>
											<li><a>${projectUserNowNo}</a></li>
											<li><a
												href="javascript:projectUserFenYe(${nowprojectid},${projectUserNowNo+1})">Next</a></li>
										</ul>
									
								
								
								
							</center>
							</div>
			
					<!-- 模态框（Modal） -->
		<div class="modal fade" id="scoreProMemberMl" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
			<div class="modal-dialog">
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
							&times;
						</button>
						<h4 class="modal-title" id="myModalLabel">
							项目成员评价
						</h4>
					</div>
					<div class="modal-body">
						<table class="table table-bordered">
			
							<tbody align="center" id="proUserDetail">
								<tr><th>成员名</th><td>Bangalore</td></tr>
								
							</tbody>
						</table>
										
						
					</div>
					<div class="modal-footer" id="scoreProMemberFooter">
						
						<button type="button" class="btn btn-primary" data-dismiss="modal" id="submit" onclick="test()">完成</button>
					</div>
				</div><!-- /.modal-content -->
			</div><!-- /.modal -->
		</div>
							
	</div>
		

</body>
</html>